<?php require_once('../Connections/miportal.php');
mysql_query("SET NAMES 'utf8'"); ?>


<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

mysql_select_db($database_miportal, $miportal);
$query_rs_can_emp = "SELECT can.id_cor_candidato, can.nb_nom_nombre1,can.nb_nom_nombre2,can.nb_nom_apaterno, can.nb_nom_amaterno, 
ies.id_nmbNombre,emp.id_nom_fiscal, emp.id_cve_rfc, emp.id_cat_empresa, emp.val_comentario, ent.nb_nomEnt, exp.tp_status_rev, ac_carrera, ac_promedio, exp.tp_status_eval, emp.tp_status_validado FROM `cor_candidato` AS can 
JOIN cat_ies AS ies USING(id_cat_ies) JOIN cor_expediente AS exp ON(can.id_cor_candidato=exp.id_cor_candidato) 
JOIN cor_ben_ies_emp AS bie ON(bie.id_cor_candidato=exp.id_cor_candidato) 
JOIN cor_ies_empresa AS ie ON(bie.id_cor_ies_empresa=ie.id_cor_ies_empresa) 
JOIN cat_empresa AS emp ON(ie.id_cat_empresa=emp.id_cat_empresa) 
JOIN cat_entidad AS ent ON(emp.id_cat_entidad=ent.id_cat_entidad) WHERE tp_status_validacion=1 AND exp.id_cat_convocatoria=19 ORDER BY ies.id_nmbNombre ASC";
$rs_can_emp = mysql_query($query_rs_can_emp, $miportal) or die(mysql_error());
$row_rs_can_emp = mysql_fetch_assoc($rs_can_emp);
$totalRows_rs_can_emp = mysql_num_rows($rs_can_emp);



//CANDIDATOS
mysql_select_db($database_miportal, $miportal);
$query_rs_can = "SELECT COUNT(*)FROM asignaciones WHERE tp_status_validacion=1 AND id_cat_convocatoria=19;";
$rs_can = mysql_query($query_rs_can, $miportal);
$totalRows_rs_can= mysql_result($rs_can,0);


/*CANDIDATOS REVISADOS*/
mysql_select_db($database_miportal, $miportal);
$query_rs_rev = "SELECT COUNT(*) FROM asignaciones WHERE tp_status_validacion=1 AND tp_status_rev<>0 AND `id_cat_convocatoria`=19;";
$rs_rev = mysql_query($query_rs_rev, $miportal);
$totalRows_rs_rev = mysql_result($rs_rev,0);

/*CANDIDATOS REVISADOS Y CUMPLE*/
mysql_select_db($database_miportal, $miportal);
$query_rs_revcumple = "SELECT COUNT(*) FROM asignaciones WHERE tp_status_validacion=1 AND tp_status_rev=1 AND `id_cat_convocatoria`=19;";
$rs_revcumple = mysql_query($query_rs_revcumple, $miportal);
$totalRows_rs_revcumple = mysql_result($rs_revcumple,0);

/*EVALUADOS QUE CUMPLEN*/
mysql_select_db($database_miportal, $miportal);
$query_rs_eval = "SELECT COUNT(*) FROM asignaciones WHERE tp_status_validacion=1 AND tp_status_rev=1 AND tp_status_eval=1 AND `id_cat_convocatoria`=19";
$rs_eval = mysql_query($query_rs_eval, $miportal);
$totalRows_rs_eval = mysql_result($rs_eval,0);

/*CUMPLEN CON TODO*/
mysql_select_db($database_miportal, $miportal);
$query_rs_cumpletodo = "SELECT COUNT(*) FROM asignaciones WHERE tp_status_validacion=1 AND tp_status_rev=1 AND tp_status_eval=1 AND tp_status_validado=1 AND tp_status_beneficiario=1 AND `id_cat_convocatoria`=19";
$rs_cumpletodo = mysql_query($query_rs_cumpletodo, $miportal);
$totalRows_rs_cumpletodo = mysql_result($rs_cumpletodo,0);




?>
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximun-scale=1">
<title>FUNDACIÓN EDUCACIÓN SUPERIOR-EMPRESA</title>
<!--Hoja de estilo principal-->
<link href="../css/styletd2.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<link rel="shortcut icon" href="stylesheet/img/devil-icon.png"> 
<link rel="stylesheet" type="text/css" href="../css/mos-style.css">
<link rel="stylesheet" type="text/css" href="../css/menu.css"><!--Pemanggilan gambar favicon-->
 <!--pemanggilan file css-->
<script src="../SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script language=""="JavaScript">
	function confirmar ( mensaje ) {
					return confirm( mensaje );
				}
        </script>
<link href="../SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css">
</head>
<body>
 <header>
    <div id="background"></div><!--BackGround Menu header-->
		<div class="img_header_logo"></div>
		<span class="img_header_logo"><a href="http://fese.org.mx"><img src="../images/fese/FESE_home_logo.png"  height="90" alt="FESE" align="bottom" /></a></span>
		<div class="img_header_logo"></div>
		
        <div id="nav">
		<ul>
		  <li class="nivel1"><a href="../report/report_can_exp.php" class="nivel1">EXPERIMENTA</a></li>
		  <li class="nivel1"><a href="../report/report_can_emp.php" class="nivel1">EMPLEATE</a></li>
          <li class="nivel1"><a href="../report/report_can_bv.php" class="nivel1">BVINCULACIÓN</a></li> 
          <li class="nivel1"><a href="../report/report_can_mpe.php" class="nivel1">MPE</a></li>  		  
		</ul>
</div><!--Menu NAV-->
        
        
</header>
<center>
<div id="boxcontainer" style="width:1300px">
<div id="container">


<table width="120%" cellspacing="0"  style="margin-left:70px;" >

<tr class="data"> 
     
      
	  <th class="data">CANDIDATOS PROPUESTOS</th>
      <th class="data">REVISADOS</th>
      <th class="data">REVISADOS COMPLETOS</th>
      <th class="data">EVALUADOS</th>
      <th class="data">BENEFICIARIOS</th>
</tr>

  <tr>  
    <td class="data"><?php echo $totalRows_rs_can;?></td> 
    <td class="data"><?php echo $totalRows_rs_rev;?></td>  
    <td class="data"><?php echo $totalRows_rs_revcumple;?></td> 
	<td class="data"><?php echo $totalRows_rs_eval;?></td> 
	<td class="data"><?php echo $totalRows_rs_cumpletodo;?></td> 
   </tr>
</table>

<br>
<br>

  <table width="95%" cellspacing="0" style="margin-left:30px;>
  
  <tr>      
      <th class="data"></th>
      <th class="data">FOLIO</th>
      <th class="data">NOMBRE CANDIDATO</th>
      <th class="data">IES</th>
      <th class="data">CARRERA</th>
      <th class="data">PROMEDIO</th>
      <th class="data">FOLIO</th>
      <th class="data">NOMBRE EMPRESA</th>
      <th class="data">COMENTARIO</th>
      <th class="data">RFC</th>
      <th class="data">ENTIDAD</th>
	  <th class="data">REVISADOS</th>
	  <th class="data">EVALUADOS</th>
      <th class="data">EVAL EMPRESA</th>
       <th class="data">CUMPLE TODO</th>
    </tr>
    
     <?php do { ?>
    
    <tr>
    <td class="data"><?php echo "EMP".str_pad($row_rs_can_emp['id_cor_candidato'],4,0, STR_PAD_LEFT)."13"; ?></td>
    <td class="data"><?php echo $row_rs_can_emp['nb_nom_nombre1'];?> <?php echo $row_rs_can_emp['nb_nom_nombre2'];?> <?php echo $row_rs_can_emp['nb_nom_apaterno'];?> <?php echo $row_rs_can_emp['nb_nom_amaterno'];?></td>
    <td class="data"><?php echo $row_rs_can_emp['id_nmbNombre']; ?></td>
    <td class="data"><?php echo $row_rs_can_emp['ac_carrera']; ?></td>
    <td class="data"><?php echo $row_rs_can_emp['ac_promedio']; ?></td>
     <td class="data"><?php echo $row_rs_can_emp['id_cat_empresa']; ?></td>
    <td class="data"><?php echo $row_rs_can_emp['id_nom_fiscal']; ?></td>
    <td class="data"><?php echo $row_rs_can_emp['val_comentario']; ?></td>
    <td class="data"><?php echo $row_rs_can_emp['id_cve_rfc']; ?></td>
    <td class="data"><?php echo $row_rs_can_emp['nb_nomEnt']; ?></td>
	<td class="data">
	
	<?php
	if($row_rs_can_emp['tp_status_rev']==1){
	
	echo "<span style=color:#0097A9>COMPLETO</span>";
	
	} else if($row_rs_can_emp['tp_status_rev']==-1){
	
	echo "<span style=color:#A9001B>INCOMPLETO</span>";
	
	}	
	
	
	?>
	
	</td>
   
	
	<td class="data">
	
	<?php
	if($row_rs_can_emp['tp_status_eval']==1){
	
	echo "<span style=color:#0097A9>CUMPLE</span>";
	
	} else if($row_rs_can_emp['tp_status_eval']==-1){
	
	echo "<span style=color:#A9001B>NO CUMPLE</span>";
	
	}
	
	
	
	?>
	</td>
    
    
    <td class="data">
	
	<?php
	if($row_rs_can_emp['tp_status_validado']==1){
	
	echo "<span style=color:#0097A9>CUMPLE</span>";
	
	} else if($row_rs_can_emp['tp_status_validado']==-1){
	
	echo "<span style=color:#A9001B>NO CUMPLE</span>";
	
	}
	
	
	
	?>
	</td>
    
    
    
    
    
    <td class="data">
	
	<?php
	if($row_rs_can_emp['tp_status_eval']==1 && $row_rs_can_emp['tp_status_rev']==1 && $row_rs_can_emp['tp_status_validado']==1){
	
	echo "<span style=color:#0097A9>CUMPLE</span>";
	
	} else if($row_rs_can_emp['tp_status_rev']==-1 || $row_rs_can_emp['tp_status_eval']==-1 || $row_rs_can_emp['tp_status_validado']==-1 ){
	
	echo "<span style=color:#A9001B>NO CUMPLE</span>";
	
	}else if($row_rs_can_emp['tp_status_validado']==0 ){
	
	echo "<span style=color:#A9001B>SIN EVALUAR</span>";	
	}
	
	?>
	</td>
    
    
    
	
    </tr>
    <?php } while ($row_rs_can_emp = mysql_fetch_assoc($rs_can_emp)); ?>
  
  
</table>

 
  
  <p>&nbsp;</p>
<p>&nbsp;</p>
  <p>&nbsp;</p>
  <div id="dinamicContaint">
  
  </div><!--dinamicContaint-->
  <p>&nbsp;</p>
</div><!--Container-->



</div><!--Boxcontainer-->
</center>
  
  
</body></html>
<?php
mysql_free_result($rs_can_emp);
?>
